<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "users".
 *
 * @property integer $id
 * @property string $username
 * @property string $password
 * @property integer $lock
 * @property string $find_id
 * @property string $get_id
 * @property string $phone
 * @property string $qq
 *
 * @property Find[] $finds
 * @property Get[] $gets
 */
class Users extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'users';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['username', 'password',"email"], 'required'],
            [['lock'], 'integer'],
            [['username', 'phone', 'qq'], 'string', 'max' => 45],
            [['password'], 'string', 'max' => 32,'min' => 6],
            [['find_id', 'get_id'], 'string', 'max' => 256],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'username' => 'Username',
            'password' => 'Password',
            'lock' => 'Lock',
            'find_id' => 'Find ID',
            'get_id' => 'Get ID',
            'phone' => 'Phone',
            'qq' => 'Qq',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getFinds()
    {
        return $this->hasMany(Find::className(), ['users_id' => 'id']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getGets()
    {
        return $this->hasMany(Get::className(), ['users_id' => 'id']);
    }
}
